﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MpSoft.Library.DAO.Settings;
using MpSoft.Library.DTO;
using MpSoft.Basic.Configuration;

namespace MpSoft.Library.BUSS.Settings
{
    #region  PaymentMethod

    public class PaymentMethodBUSS
    {
        private const string PAYMENTMETHOD_ALL_KEY = "Mp.paymentmethod.all-{0}";
        private const string PAYMENTMETHOD_BY_ID_KEY = "Mp.paymentmethod.id-{0}";

        private static void PaymentMethodRemoveCache()
        {
            MpCache.RemoveByPattern(PAYMENTMETHOD_ALL_KEY);
            MpCache.RemoveByPattern(PAYMENTMETHOD_BY_ID_KEY);
        }

        public static int PaymentMethod_Add(PaymentMethod obj)
        {
            var result = PaymentMethodDAO.PaymentMethod_Add(obj);
            return result;
        }
        public static int PaymentMethod_Update(PaymentMethod obj)
        {
            var result = PaymentMethodDAO.PaymentMethod_Update(obj);
            return result;
        }

        public static int PaymentMethod_Delete(int PaymentMethodID)
        {
            var result = PaymentMethodDAO.PaymentMethod_Delete(PaymentMethodID);
            return result;
        }

        public static PaymentMethod PaymentMethod_ByID(int PaymentMethodID)
        {
            var list = PaymentMethod_Select(PaymentMethodID, 1, false);
            if (list != null)
                return list.FirstOrDefault();
            return null;
        }

        public static List<PaymentMethod> PaymentMethod_Select(int PaymentMethodID, int DisplayOrder, bool IsActive)
        {
            return PaymentMethodDAO.PaymentMethod_Select(PaymentMethodID, DisplayOrder, IsActive);
        }

    }

    #endregion
}
